package com.zjz.common.demo.oom.inheritance;

/**
 * @author Zhang Jinzhong
 * @version V1.0
 * @since 2018-09-29 10:16
 */
public class Bicycle {

    /**
     * 自行车踏频器
     */
    public int cadence;

    // the Bicycle class has three fields
    /**
     * 排挡
     */
    public int gear;
    public int speed;
    //    @Getter
    private int idPrivate = 12345;

    // the Bicycle class has one constructor
    public Bicycle(int startCadence, int startSpeed, int startGear) {
        gear = startGear;
        cadence = startCadence;
        speed = startSpeed;
    }

    public void setCadence(int newValue) {
        cadence = newValue;
    }

    public void setGear(int newValue) {
        gear = newValue;
    }

    public void applyBrake(int decrement) {
        speed -= decrement;
    }

    public void speedUp(int increment) {
        speed += increment;
    }

    public void printDescription() {
        System.out.println("\nBike is " + "in gear " + this.gear + " with a cadence of " + this.cadence
            + " and travelling at a speed of " + this.speed + ". ");
    }

    public void printDescription(String tip) {
        printDescription();
        System.out.println(tip);
    }
}

